<template>
	<view style="padding:20rpx">
		<view class="box" style="display: flex;align-items: center;margin-bottom: 20rpx;">
			<image :src="user.avatar" style="width: 150rpx;height:150rpx;border-radius: 50%;" mode="widthFix"></image>
			<view style="flex:1;margin-left: 30rpx;">
				<view style="margin-bottom: 20rpx;font-size: 32rpx;">{{user.userName}}</view>
				<view style="color: #888;">{{user.phonenumber}}</view>
			</view>
		</view>
		<view class="box" style="margin-bottom: 20rpx;">
			<view style="display: flex;">
				<navigator class="item" url="/pages/orders/orders">
					<image src="@/static/预约记录.png" style="width: 50%;" mode="widthFix"></image>
					<view>预约记录</view>
				</navigator>
				<navigator class="item" url="">
					<image src="@/static/报告查询.png" style="width: 50%;" mode="widthFix"></image>
					<view>报告查询</view>
				</navigator>
				<navigator class="item" url="">
					<image src="@/static/余额.png" style="width: 50%;" mode="widthFix"></image>
					<view>医币充值</view>
				</navigator>
				<navigator class="item" url="">
					<image src="@/static/问题反馈.png" style="width: 50%;" mode="widthFix"></image>
					<view>问题反馈</view>
				</navigator>
			</view>
		</view>
		<view class="box">
			<navigator url="/pages/myInformation/myInformation" style="padding: 15rpx; border-bottom: 2rpx solid #eee;">
				<uni-icons type="person" size="18"></uni-icons>
				<text style="margin-left: 10rpx;">个人信息</text>
				<uni-icons type="right" color="#999" style="float: right;"></uni-icons>
			</navigator>
			<navigator url="/pages/about/about" style="padding: 15rpx; border-bottom: 2rpx solid #eee;">
				<uni-icons type="help" size="18"></uni-icons>
				<text style="margin-left: 10rpx;">关于我们</text>
				<uni-icons type="right" color="#999" style="float: right;"></uni-icons>
			</navigator>
			<navigator url="" style="padding: 15rpx; border-bottom: 2rpx solid #eee;">
				<uni-icons type="info" size="18"></uni-icons>
				<text style="margin-left: 10rpx;">用户协议</text>
				<uni-icons type="right" color="#999" style="float: right;"></uni-icons>
			</navigator>
			<view style="padding: 15rpx; border-bottom: 2rpx solid #eee;" @click="logout">
				<uni-icons type="undo" size="18"></uni-icons>
				<text style="margin-left: 10rpx;">退出登录</text>
				<uni-icons type="right" color="#999" style="float: right;"></uni-icons>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				user: uni.getStorageSync('xm-user')
			}
		},
		onShow() {
			this.user = uni.getStorageSync('xm-user')
		},
		methods: {
         logout(){
			 uni.showModal({
			 	title:'提示',
				content:'确定要退出吗？',
				success: (res) => {
					if(res.confirm){
						uni.clearStorageSync('xm-user')
						uni.redirectTo({
							url:'/pages/login/login'
						})
					}
				}
				
			 })
		 }
		}
	}
</script>

<style>
	.box {
		background-color: #fff;
		padding: 20rpx;
		border-radius: 10rpx;
		box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, .1);
	}

	.item {
		flex: 1;
		display: flex;
		flex-direction: column;
		align-items: center;
		grid-gap: 10rpx;
	}
</style>